﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CategoryList.ascx.cs"
    Inherits="Admin_Module_Category_Controls_CategoryList" %>
<%@ Register TagPrefix="avg" Namespace="Avg.Controls" Assembly="SmartPager" %>
<%@ Import Namespace="DemoObject" %>
<%@ Import Namespace="BusinessObjects" %>
<div id="tabs" style="padding: 20px 20px;">
    <div class="box-search">
        <div class="box-1">
            Loại tin cha:<br />
            <asp:DropDownList ID="ddlParent" runat="server" Width="150px" AppendDataBoundItems="true">
                <asp:ListItem Text="Tất cả" Selected="True" Value=""></asp:ListItem>
            </asp:DropDownList>
        </div>
        <div class="box-btnSearch">
            <asp:Button ID="btnSearch" runat="server" Text="Tìm" Width="100%" OnClick="btnSearch_Click" />
        </div>
        <div style="clear: both">
        </div>
    </div>
</div>
<br />
<div id="tabs1">
    <ul>
        <li><a href="#tabs1-1">Danh sách loại tin </a></li>
    </ul>
    <div id="tabs1-1">
        <div style="text-align: right;">
            <a href='/Admin/Module/Category/CategoryAE.aspx'>
                <input type="button" class="ui-widget-content ui-corner-all textfield cursor" value="Thêm loại tin" /></a>
            <asp:Button ID="btnUpdateOrder" runat="server" Text="Cập nhật vị trí" CssClass="ui-widget-content ui-corner-all textfield cursor"
                OnClick="btnUpdateOrder_Click" />
        </div>
        <asp:GridView ID="grv" runat="server" CssClass="grid" AllowSorting="true" AutoGenerateColumns="false"
            OnSorting="grv_Sorting" OnRowCommand="grv_RowCommand">
            <Columns>
                <asp:TemplateField HeaderText="STT" SortExpression="Name" HeaderStyle-Width="20"
                    HeaderStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="20px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Loại tin" SortExpression="Name">
                    <ItemTemplate>
                        <%#Eval("Name") %><br />
                        <a style="color:Blue" href='<%#UrlBuilder.UrlListNews(Eval("TextId").ToString())%>'><%#UrlBuilder.UrlListNews(Eval("TextId").ToString())%></a>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Loại tin cha" SortExpression="Name">
                    <ItemTemplate>
                        <%#((TblCategory)Container.DataItem).TblCategory1!=null?((TblCategory)Container.DataItem).TblCategory1.Name:"--" %>
                    </ItemTemplate>
                </asp:TemplateField>
                <%--<asp:TemplateField HeaderText="SL Loại con" HeaderStyle-Width="50">
                    <ItemTemplate>
                        <%# new  TblCategoryRepository().SelectListItem(null,"","",new Guid(Eval("Id").ToString()),null,null,new System.Collections.Generic.HashSet<string>()).Count %>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>--%>
                <asp:TemplateField HeaderText="Ng tạo" SortExpression="CreatedBy" HeaderStyle-Width="100">
                    <ItemTemplate>
                        <%#Eval("CreatedBy") %>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ngày tạo" SortExpression="CreatedDate" HeaderStyle-Width="90">
                    <ItemTemplate>
                        <%# ((DateTime)Eval("CreatedDate")).ToString("dd/MM/yyyy") %>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderStyle-Width="100">
                    <ItemTemplate>
                        <asp:CheckBox ID="cbIsVisible" runat="server" Checked='<%#Eval("IsVisible") %>' Text="Ẩn/Hiện" /><br />
                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%#Eval("IsPublish") %>' Text="Trang chủ" /><br />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderStyle-Width="50" SortExpression="DisplayOrder" HeaderText="VT">
                    <ItemTemplate>
                        <asp:HiddenField ID="hdfParentId" runat="server" Value='<%#Eval("ParentId") %>' />
                        <asp:TextBox ID="txtOrder" runat="server" Width="50px" Text='<%#Eval("DisplayOrder") %>'
                            Style="text-align: center"></asp:TextBox>
                        <asp:HiddenField ID="hdfOrder" runat="server" Value='<%#Eval("DisplayOrder") %>' />
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="*"
                            ControlToValidate="txtOrder" ValidationExpression="^([1-9]|[1-9][0-9]|[1][0][0])$"></asp:RegularExpressionValidator>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField >
                    <HeaderTemplate>
                        <a href="/Admin/Module/Category/CategoryAE.aspx">Thêm</a>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:HiddenField ID="hdfId" runat="server" Value='<%#Eval("Id") %>' />
                        <ul class="bullet-more">
                            <li><a href='/Admin/Module/Category/CategoryAE.aspx?CategoryId=<%#Eval("Id") %>'
                                class="blue">Sửa</a> </li>
                            <li>
                                <asp:LinkButton ID="lnkDelete" runat="server" CommandName="DeleteItem" CommandArgument='<%#Container.DataItemIndex %>'
                                    CssClass="blue" OnClientClick="return confirmDelete()">Xóa</asp:LinkButton>
                            </li>
                        </ul>
                    </ItemTemplate>
                    <HeaderStyle Width="50px"></HeaderStyle>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <avg:SmartPager ID="smartPager" runat="server" Visible="false" />
        <div style="text-align: right;">
            <asp:Button ID="Button1" runat="server" Text="Cập nhật vị trí" CssClass="ui-widget-content ui-corner-all textfield cursor"
                OnClick="btnUpdateOrder_Click" />
        </div>
    </div>
</div>
